Symbols and Operators

Operators are tools to perform operations on a number. Some operators you might recognise already are +, -, <, etc. Operators are used to affect one or more items. For example, we might compare two items using operators, or add two items together.

Priority

Some operators have a higher priority than others. This means they happen first in a line of code even if they do not appear first. For example:

a = 10 * 30 + 5

In this example, the multiply will happen before the addition, giving a result of 305. This is because the multiplication operation has a higher priority than addition.

When operators have the same priority, they happen in order of appearance. For example:

a = 10 + 30 - 5

In this example, the addition happens before the subtraction because it appears first.

Below are all of the operators in FUZE4 Nintendo Switch listed in order of priority. Higher priority operators happen before lower. Operators in the same group have the same priority.

Group 0 - Brackets

Brackets behave in a special way. Anything inside brackets will take place first, even if the operations within the brackets have a lower priority than operations outside them. Of course, operations within the brackets still behave in terms of their normal priority.

( ) Parentheses - Used to change the order of evaluation. Operations inside parentheses will happen before operations on the outside. Parentheses are also used to set the arguments of a function call.

[ ] Square Brackets - Used with arrays to define a number of elements, or to index into an array.

{ } Curly Brackets - Used to define a vector. Empty curly brackets sets default values of { 0, 0, 0, 0 }.

Group 1 - Highest Priority

NOT, ! Not - Performs the logical inversion on a given value. False becomes true, true becomes false. Either NOT or ! can be used.

BNOT, ~ Binary Not - Performs the Not operation on a bitwise basis. Either BNOT or ~ can be used.

Group 2

* Multiply - Used to multiply a value by another.

/ Divide - Used to divide a value by another.

MOD, % Modulo - Used to give the remainder of a division. Either MOD or % can be used.

Group 3

+ Add - Used to add two values together. Also used to join string content together.

- Minus - Used to subtract a value from another. Also used as a sign to indicate a negative number.

<< Shift Left - Used to perform the bit shift operation to the left. Effectively multiplies a value by two for the number of bits shifted.

>> Shift Right - Used to perform the bit shift operation to the right. Effectively divides a value by two for the number of bits shifted.

& Binary And - Performs the and operation on a bitwise basis.

| Binary Or - Performs the or operation on a bitwise basis.

^ Exclusive Or - Used to perform the exclusive or operation

Group 4

== Double Equals - Used to compare two values and determine whether they are exactly equal to each other.

< Less Than - Used to compare two values and determine whether one is less than the other.

<= Less Than or Equal To - Used to compare to values and determine whether one is less than or equal to the other.

> Greater Than - Used to compare two values and determine whether one is greater than the other.

>= Greater Than or Equal To - Used to compare two values and determine whether one is greater than or equal to the other.

!= Not Equal To - Used to compare two values and determine whether they are not equal to each other.

Group 5

AND Logical And - Used to compare two values to determine whether they are both true.

Group 6

OR Logical Or - Used to compare two values to determine whether either are true.

Group 7 - Lowest Priority

= Assign - Used to assign a value to a variable.

+= Plus Equals - Used to perform an addition on the contents of a variable.

-= Minus Equals - Used to perform a subtraction on the contents of a variable.

*= Times Equals - Used to perform a multiplication on the contents of a variable.

/= Divide Equals - Used to perform a division on the contents of a variable.